<%@ taglib uri="/WEB-INF/taglib/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/taglib/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/taglib/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/taglib/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>


<h1><bean:message key="projects.title.search"/></h1>

<p>
	<c:choose>
		<c:when test="${all}">
			<html:link page="/projects.do">
				<bean:message key="project.list.seeopen" />
			</html:link>
		</c:when>
		<c:otherwise>
			<html:link page="/projects.do?cmd=listClose">
				<bean:message key="project.list.seeclose" />
			</html:link>
		</c:otherwise>
	</c:choose>

	<c:choose>
		<c:when test="${search}"></c:when>
		<c:otherwise>
			<html:link page="/projects.do?cmd=search"><bean:message key="projects.search.title" /></html:link>
		</c:otherwise>
	</c:choose>
</p>
<p id="list_project">
	<display:table name="projects" id="row" requestURI="/projects.do" pagesize="20">

		<display:column sortable="true" titleKey="project.list.subject" sortProperty="subject">
			<html:link page="/project.do?cmd=view&id=${row.id}">${row.subject}</html:link>
		</display:column>
		<display:column sortable="true" titleKey="project.list.manager" property="manager.name" />
		<display:column sortable="true" property="category.name" titleKey="project.list.categorie" />
		<display:column sortable="true" property="shortDescription" titleKey="project.list.description" />
		<display:column sortable="true" property="createdDate" titleKey="project.list.createddate" format="{0,date}" />
		<display:column sortable="true" sortProperty="nbJobRemain" titleKey="project.list.nbjobremain" >
			<html:link page="/jobs.do?cmd=list&idproject=${row.id}&complete=0">${row.nbJobRemain}</html:link>
		</display:column>
		<display:column sortable="true" sortProperty="nbJob" titleKey="project.list.nbjobtotal">
			<html:link page="/jobs.do?cmd=list&idproject=${row.id}">${row.nbJob}</html:link>
		</display:column>
		<display:column titleKey="project.list.status">
			<c:choose>
				<c:when test="${row.complete}">
					<bean:message key="project.list.close"/>
				</c:when>
				<c:otherwise>
					<bean:message key="project.list.open"/>
				</c:otherwise>
			</c:choose>
		</display:column>

		<display:setProperty name="paging.banner.placement" value="top" />
		<display:setProperty name="paging.banner.item_name"><bean:message key="project.list.item_name" /></display:setProperty>
		<display:setProperty name="paging.banner.items_name"><bean:message key="project.list.items_name" /></display:setProperty>

	</display:table>
</p>